Instructions for using CW1.1.1.2 (AKA CW4.5) with MacApp3.1.1
--Mark Anderson
--metrowerks
--9/27/94
•••Do not use these mods or projects with versions older than CW1.1.1. In particular you can't use these mods with CW4 (AKA CW1.1).
•••In order to run the debug versions included here, you must have Scriptable Text Editor. STE comes with AppleScript which is included on the CW4 CD.
Before you start, a few comments.
•Segment unloading is back to stay! I rewrote UMemory.a so it will work with CW's jump tables so to all of you who can't wait to ship your product with CW builds, what's stopping you now? To facilitate segment handling, I created some new res! resources and laid out the sources and libraries all in one segment. By keeping them all together, all code without an explicit pragma segment, which includes the MacOS library and some of the MacApp code, gets put into the first segment. CW always names the first segment __%Main and it is now included as a res! resource. Wherever there is a MacApp named segment I could use, I did as with STDCLIB and SANELIB. There is a bug in the last version of CW I tested whereby if you have #pragma segment foo and a segment foo in the project window, then you will end up with 2 segments named foo in your project. The workaround until it is fixed for CW5 is to never name a project window segment the same thing that you use in pragma segment.
•The AppleEvent hack for qDebug builds is still necessary. Stderr must be launched before a PPC build of a MacApp app or Scriptable Text Editor will bus error when you quit. If anyone has a clue why this is happening, please contact me.
•The only code model supported by my segment unloading code is Large (far). This will seem confusing since qModelFarCode is and must be false. My (lame) excuse is that it was much easier for me to change MacApp's near version than their far version of memory management. It might be possible that Small (near) model will be supported in the future.
If anyone has problems with the segment loading please contact me at marka4@metrowerks.com.
How to setup MacApp 3.1.1 and CW 1.1.1.2.
1 Start with a clean copy of MacApp3.1.1
2 Remove MacApp Stuff ƒ from the Compiler folder if it is there (this was the folder that was included on CW4). The current package replaces all of those files.
3 Open and observe the contents of "MacApp3.1.1 & CW4.5".
*There is a folder called "Put these in top level MA3.1.1". Make sure that the folders "CW Support ƒ" and "CW Examples" are at the top level of the MacApp 3.1.1 folder. The "CW Examples" folder cantains projects for only DemoDialogs. There is another download for the remaining projects.
*There is a folder called "Modifications". Here you have a choice. Inside it is a file called "Use these Mods" that are the necessary changes to the MacApp sources and headers. If you would rather just do a wholesale replace, I've included all of the individual files that have any changes that I have made in the folder "*OR* replace these Files". Make _all_ changes.
4 Precompile your headers. Please follow these steps.
*Open DemoDialogs68K_d.π found in CW Examples:68K:DemoDialogs:Debug version:. (Precompiling can only be done while there is an open project--the precompiled header will use the preference settings of the open project.) Now open MacAppHeaders_d.h found in CW Support ƒ:. Notice that the file has the same format as you saw in CW4 except it is now a little simpler to use. The _d in the name means you will use this as the prefix file for all debug versions and its _nd cousin for all of the nodebug versions (the wantDebugging flag is set accordingly). Now all you (usually) have to remember is to set the flag WantToPrecompile to 1 or 0. But look a little further into MacAppHeaders.cp. As much as possible, CW's project flags now will set the state of MacApp's flags. Unfortunately CW has a limited number of such flags so make sure they are set to your liking and that the project settings match your MacApp settings. In particular note the qPerform flag and its limitations; set it if you wish.
*Set WantToPrecompile to 1 and select Precompile. Save the precompiled header as MacAppHeaders68K_debug and save it inside CW Support ƒ.
*Set WantToPrecompile back to 0, save and close. (Would you like a short cut? Since you will also want to build a precompiled header for nodebug, keep WantToPrecompile at 1 and clear wantDebugging to 0. Precompile and name the file MacAppHeaders68K_nodebug. Notice how much faster it precompiles once it knows where all of the files are. Make sure to set WantToPrecompile back to 0, and wantDebugging to 1; save and close.)
xxxxxxxxxxxxxxxxxxxxxx
If you have trouble precompiling (you get errors during the precompile process), did you deviate from the instructions here in any way? If so, try it my way first. In particular, make sure you put the CW Support ƒ and CW Examples in the top level of MacApp and get rid of the folder "MacApp and CW" (from CW4 CD).
xxxxxxxxxxxxxxxxxxxxxx
5 Build the project with Command M. When done, launch Stderr found in
:DemoDialogs:Debug: and launch DemoDialogs68K. Select Show Debug Flags Window and set all of the flags for Memory usage, Events and Commands and Segments. The Stderr window will show the segments loading and unloading just as they do with MPW builds. If your debugger setup allowed it and you set qPerform you can also use the MPW Performance tools.
xxxxxxxxxxxxxxxxxxxxxx
Some people had enormous difficulty getting the CW4 and MacApp3.1.1 sources to compile--I know how frustrating it can be. One simple mistake I always make is to remember to clear WantToPrecompile after precompiling. It also may seem that the compiler is picky about the precompiled headers. Even if you have precompled the MacAppHeaders, you sometimes get a boat load of redefines and undefines. That problem usually happens if I precompile for one project with one particular group of settings and try to use the header with a different project with different settings. In particular, I tracked down a program where far data was set in the first project and far data wasn't set in the other file. The included projects (should) have all of their settings compatable with each other. If you need other settings (don't change Code Model), you'll need to precompile with an open project with those settings. Other things that seem to work for some people is to remove binaries and reset file paths (both commands are available from the menus). If it still doesn't work and you are sure that the settings are identical, just give up, re-precompile and let Support know. Expect to re-precompile everytime you make a significant change to your environment such as a new compiler, installing a new version of MacApp, moving pre-compiled headers across state boundaries, etc.
xxxxxxxxxxxxxxxxxxxxxx
6 To build a library version of MacApp, please use the appropriate project found in CW Support ƒ:MA68K Library or MAPPC Library. There are now debug and nodebug versions of the libraries so that you don't have to rename the output files.